var path = require('path');
var webpack = require('webpack');

module.exports = {
    entry: {
        app: path.join(__dirname, './src/main.js'),
        vendor: [
            "vue",
            "vuex",
            "vue-router",
            "vue-touch-ripple"
        ],
    },
    output: {
        path: path.join(__dirname, "./dist"),
        filename: '[name].bundle.js',
    },
    devtool: 'source-map',
    resolve: {
        alias: {
            /*vue 的 package.json 中的 main 指向的是 dist/vue.common.js
            这里需要改成 vue/dist/vue.js*/
            'vue': 'vue/dist/vue.js'
        },
        extensions: ['.js', '.vue']
    },
    module: {
        rules: [
            {
                test: /\.vue$/,
                //exclude: /(node_modules|bower_components)/,
                loader: 'vue-loader'
            },
            {
                test: /\.js$/,
                //exclude: /(node_modules|bower_components)/,
                loader: 'babel-loader'
            },
            {
                test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
                exclude: /(node_modules|bower_components)/,
                loader: 'url-loader',
                options: {
                    limit: 10000
                }
            },
            {
                test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
                exclude: /(node_modules|bower_components)/,
                loader: 'url-loader',
                options: {
                    limit: 10000
                }
            }
        ]
    },
    plugins: [
		new webpack.optimize.CommonsChunkPlugin({
            name: 'vendor'
        })
	],
}
